package cn.terminus.data.customer.settledenterprisebillinfo.impl;

import cn.terminus.common.customer.bean.settledenterprisebillinfo.dto.*;
import cn.terminus.data.customer.settledenterprisebillinfo.dao.SettledEnterpriseBillInfoDao;
import cn.terminus.data.customer.settledenterprisebillinfo.mapper.SettledEnterpriseBillInfoMapper;
import cn.terminus.result.common.page.TerminusPageAble;
import cn.terminus.result.common.page.TerminusPageInfo;
import cn.terminus.result.common.util.BeanCopyUtils;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * (SettledEnterpriseBillInfo)表服务实现类
 *
 * @author makejava
 * @since 2021-07-08 11:19:04
 */
@Repository
public class SettledEnterpriseBillInfoDaoImpl implements SettledEnterpriseBillInfoDao {
    @Resource
    private SettledEnterpriseBillInfoMapper settledEnterpriseBillInfoMapper;

    @Override
    public Integer add(SettledEnterpriseBillInfoNewDto dto) {
        return settledEnterpriseBillInfoMapper.add(dto);
    }

    @Override
    public Integer update(SettledEnterpriseBillInfoNewDto dto) {
        return settledEnterpriseBillInfoMapper.update(dto);
    }

    @Override
    public List<SettledEnterpriseBillInfoResultDto> gets(SettledEnterpriseBillInfoGetsDto dto) {
        return settledEnterpriseBillInfoMapper.gets(dto);
    }

    @Override
    public List<SettledEnterpriseBillInfoResultDto> query(SettledEnterpriseBillInfoQueryDto dto) {
        return settledEnterpriseBillInfoMapper.query(dto);
    }

    @Override
    public Integer delete(SettledEnterpriseBillInfoDeleteDto dto) {
        return settledEnterpriseBillInfoMapper.delete(dto);
    }

    @Override
    public TerminusPageAble<SettledEnterpriseBillInfoResultDto> page(SettledEnterpriseBillInfoQueryDto dto, TerminusPageInfo page) {
        PageHelper.startPage(page.getCurrentPage(), page.getPageSize());
        Page<SettledEnterpriseBillInfoResultDto> result = (Page<SettledEnterpriseBillInfoResultDto>) settledEnterpriseBillInfoMapper.query(dto);
        return new TerminusPageAble<>(BeanCopyUtils.copy(result.getResult(), SettledEnterpriseBillInfoResultDto.class), page, result.getTotal());
    }
}
